SM2 algorithm